;(function () {
  const __dc = document.createElement('script'),
    __s = document.getElementsByTagName('script')[0],
    __url = 'j1.58cdn.com.cn/beidou-sdk/browser/bundle.min.js'
  __dc.type = 'text/javascript'
  __dc.async = false
  __dc.src = ('https:' === document.location.protocol ? 'https://' : 'http://') + __url
  const wHost = window.location.host
  const isOnline = wHost.includes('58corp')
  const hashParam = {
    online: {
      projectId: 0, // 必传 ，在58北斗监控平台添加项目时，生成的项目ID
      isProd: process.env.NODE_ENV === 'development' || !isOnline ? false : true, //  非必传， 是否将捕获的异常信息发送到北斗服务器
      isDebug: false, // 非必传  是否打印日志 为true时 打印 默认为false
      overtime: 600000,
      beforeSend(event: any) {
        const { apis } = event
        if (Array.isArray(apis) && +apis[0].statusCode === 302) {
          return null
        }
        return event
      }
    },
    test: {
      projectId: 1001,
      beforeSend(event: any) {
        const { type } = event
        return event
      }
    }
  }
  __dc.onload = function () {
    window.Beidou.init(hashParam[isOnline ? 'online' : 'test'])
  }
  __s.parentNode && __s.parentNode.insertBefore(__dc, __s)
})()
